<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductRelationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_relations', function (Blueprint $table) {
            $table->id()->comment('商品点赞和收藏表');
            $table->integer('product_id')->index()->comment('商品ID');
            $table->integer('user_id')->index()->comment('用户id');
            $table->tinyInteger('type')->index()->default(0)->comment('类型(0 = 收藏、1 = 点赞)');
            $table->string('category' ,20)->comment('活动类型 noActivity : 普通商品，seckill : 秒杀，bargain : 砍价，combination : 拼团');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_relations');
    }
}
